<%@page import="com.kaishengit.pms.entity.EmployeeProject"%>
<%@page import="com.kaishengit.pms.entity.Employee"%>
<%@page import="com.kaishengit.pms.entity.Message"%>
<%@page import="com.kaishengit.pms.util.TimeNoteUtil"%>
<%@page import="com.kaishengit.pms.util.DateUtil"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<style type="text/css">
		body{
			background-image:url(img/bb.jpg);
			background-repeat:repeat-x;
		}
	</style>
</head>
<body class="body">
	
	<%@ include file="include/main-top.jsp" %>
	<div class="container">
	  <div class="row">
 		<jsp:include page="include/left.jsp">
			<jsp:param value="new" name="tag"/>
		</jsp:include>
		<div class="span6">
			
		  	<ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;">
				<li class="active">
					<i class="icon-th"></i>你在想什么？
				</li>
			</ul>
			<div class="well">
				<form style="margin:0px" action="javascript:;" method="post">
					<textarea name="msg" id="msg" style="width:415px" rows="3"></textarea>
					<button class="btn btn-primary" id="btn">发布</button>
				</form>
			</div>
			<ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;margin-top:20px">
				<li class="active">
					<i class="icon-th"></i>信息流
				</li>
			</ul>
			<div class="well">
				<div id="showmsg"></div>
				<%	
					EmployeeProject ep = (EmployeeProject) session.getAttribute("ep");
					List<Message> msglist = (List<Message>)session.getAttribute("msglist");
					for(Message m : msglist){
				 %>
				  
				<img src="upload/<%=m.getEmployee().getPic() %>" width="20px" height="20px"><span style="color:#000; font-size:14px"><%=m.getEmployee().getUsername() %>:  <%=m.getContent() %></span> <br/>
				
					<div><%=TimeNoteUtil.getTime(m.getCreatetime()) %></div>
					<br/>
					 
				<%} %>
			</div>
		</div>
		<div class="span3">
			<div class="box">
				<div class="well">
					<div class="head ">	<h4>我的任务 </h4></div>
					<c:forEach var="task" items="${taskList}">
						<ul>
							<li>
								<a href="">${task.name}</a>
							</li>
						</ul>
					</c:forEach>
			</div>
		</div>
	  </div>
	</div>
	
	<script type="text/javascript">
		$(document).ready(function(){
		
			$('#btn').click(function(){
				if($('#msg').val() == "" || $('#msg').val() == null){
					$('#msg').focus();
					return false;
				}
				
				var msg = $('#msg').val();
				var addmessage = "addmessage";
				
				
				$("<img>").attr("src","upload/<%=ep.getEmployee().getPic()%>").attr("width","20px").attr("height","20px").appendTo($('#showmsg'));
				$("<span>${session_em.username}:"+msg+"</span>").attr("style","color:#000;font-size:14px").appendTo($('#showmsg'));
				$("<br>").appendTo($('#showmsg'));
				$("<div><%=TimeNoteUtil.getTime(DateUtil.getNow())%></div>").appendTo($('#showmsg'));
				$("<br>").appendTo($('#showmsg'));
				$.post("newmessage.jspx",{m:addmessage,msg:msg});
				
				
			});
			
			
			$('#btn').click(function(){
				$('btn').submit();
			});
			
		});
	
	</script>
</body>
</html>